<%--
  Created by IntelliJ IDEA.
  User: lenovo
  Date: 2020/9/12
  Time: 19:00
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>登陆页面</title>
</head>
<body>

<form action="/day4/loginStudentServlet" method="get">

    <%!String username="";%>
    <%!String password="";%>
    <%!String remember="";%>
    <%Cookie[] cookies = request.getCookies();
        for (Cookie cookie : cookies) {
            if (cookie.getName().equals("remember")&&cookie.getValue()!=null) {
                remember = cookie.getValue();
            }

            if (cookie.getName().equals("username")) {
                username = cookie.getValue();
            }
            if (cookie.getName().equals("password")) {
                password = cookie.getValue();
            }
            }
        if (remember == null) {
            username = "";
            password = "";
        }
    %>



    <label for="username">账号:</label>
    <input type="com.itheima.text" name="username" required placeholder="请输入账号" id="username" value="<%=username%>"><br>

    <label for="password">密码:</label>
    <input type="password" name="password" required placeholder="请输入密码" id="password" value="<%=password%>"><br>
    <input type="checkbox" id="remember" value="remember" name="remember" checked="<%if (remember!=""){out.print("true");}%>">
    <label for="remember">记住用户名和密码</label><br>
    <input type="submit" value="登陆">
</form>
</body>
</html>
